import java.time.YearMonth;

public class MonthYearComparison {
    public static void main(String[] args) {
        YearMonth yearMonth1 = YearMonth.of(2023, 5);
        YearMonth yearMonth2 = YearMonth.of(2023, 8);

        if (yearMonth1.equals(yearMonth2)) {
            System.out.println("The months and years are equal.");
        } else {
            System.out.println("The months and years differ.");
        }
        
        if (yearMonth1.isBefore(yearMonth2)) {
            System.out.println("First date comes before second date");
        }

        if (yearMonth1.isAfter(yearMonth2)) {
            System.out.println("First date comes after second date");
        }
    }
}